-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add documentation about OpenXR spatial entities #11015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add documentation about OpenXR spatial entities #11015
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed a few grammatical issues and typos so I wanted to make a review addressing some of them. I saw that it was also a commonality in this PR to omit commas after dependent clauses, so I left in 2 cases where I noticed it occurred, but I can go back and mark more where I noticed them.
OpenXR spatial entities | ||
======================= | ||
|
||
For any sort of augemented reality application you need to access real world information and be able to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, "augemented" should be "augmented."
It has a very modular design. The core of the API defines how real world entities are structured, | ||
how they are found and how information about them is stored and accessed. | ||
|
||
Various extensions are added ontop that implement specific systems such as marker tracking, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a space between "on top."
Spatial anchors allow us to map real world location in our virtual world in such a way that the | ||
XR runtime will keep track of these locations and adjust them as needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use of singular "location" in "real world location" but use of plural "locations" in "... will keep track of these locations"
|
||
Spatial anchors allow us to map real world location in our virtual world in such a way that the | ||
XR runtime will keep track of these locations and adjust them as needed. | ||
If supported anchors can be made persistent which means the anchors will be recreated in the correct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets nitpicky since it's been a commonality in this PR to not include commas after dependent clauses but this is my first time noticing it.
Original comment was
Add a comma after "If supported."
When needed the location of the spatial anchor will be updated automatically, the pose on the | ||
related tracker will be updated and thus the :ref:`XRAnchor3D<class_XRAnchor3D>` node will | ||
reposition. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kinda nitpicky, but I would write it to add a comma after "When needed," and change the comma after "automatically" to a period to prevent this sentence from being a run on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, looking at it again, the comma after automatically would probably be better as a semicolon ';' instead of a period.
related tracker will be updated and thus the :ref:`XRAnchor3D<class_XRAnchor3D>` node will | ||
reposition. | ||
|
||
When a spatial anchor has been made persistent a Universally Unique Identifier (or UUID) is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets nitpicky since it's been a commonality in this PR to not include commas after dependent clauses but this is my second(ish) time noticing it.
Original comment was
Comma after persistent as "When a spatial anchor has been made persistent" is a dependent clause.
|
||
|
||
Finally we can process our snapshot. Note that we are using :ref:`OpenXRAnchorTracker<class_OpenXRAnchorTracker>` | ||
as our tracker class as this already has all the support for anchors build in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"build in" should be "built in" since it's past tense.
With April tags and Aruco markers binary data is encoded based which you again can access when a marker is found, | ||
however you need to configure the detection with the correct decoding format. | ||
|
||
As an example we'll create a spatial context that will find QR codes adn Aruco markers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, "adn" should be "and."
Some XR runtimes do require vendor extensions to enable and/or configure this process | ||
but the data will be exposed through this extension. | ||
|
||
The code we write up above for the spatial manager will already detect our new planes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"write" probably should be "wrote" for past tense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do a pass to improve sentence structure as well later
extends Node3D | ||
|
||
## Signals a new spatial entity node was added. | ||
signal added_spatial_entity(node : XRNode3D) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signal added_spatial_entity(node : XRNode3D) | |
signal added_spatial_entity(node: XRNode3D) |
For all
signal removed_spatial_entity(node : XRNode3D) | ||
|
||
## Scene to instantiate for spatial anchor entities. | ||
@export var spatial_anchor_scene : PackedScene |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@export var spatial_anchor_scene : PackedScene | |
@export var spatial_anchor_scene: PackedScene |
For all
## Scene to instantiate for mark tracking spatial entities. | ||
@export var marker_tracker_scene : PackedScene | ||
|
||
# Trackers we manage nodes for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Trackers we manage nodes for | |
# Trackers we manage nodes for. |
For all
- Description | ||
* - OPENXR_SPATIAL_COMPONENT_TYPE_MARKER | ||
- :ref:`OpenXRSpatialComponentMarkerList<class_OpenXRSpatialComponentMarkerList>` | ||
- Provides us with the type, id (Aruco and April Tag) and/or data (QR Code) for each marker. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Provides us with the type, id (Aruco and April Tag) and/or data (QR Code) for each marker. | |
- Provides us with the type, ID (Aruco and April Tag) and/or data (QR Code), for each marker. |
======================= | ||
|
||
For any sort of augemented reality application you need to access real world information and be able to | ||
track real world locations. OpenXRs spatial entities API was introduced for this exact purpose. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
track real world locations. OpenXRs spatial entities API was introduced for this exact purpose. | |
track real world locations. OpenXR's spatial entities API was introduced for this exact purpose. |
# it will exit if we've called it too early. | ||
_setup_spatial_context() | ||
|
||
func _exit_tree(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func _exit_tree(): | |
func _exit_tree(): |
|
||
func _exit_tree(): | ||
if spatial_context: | ||
# disconnect from our discovery signal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# disconnect from our discovery signal. | |
# Disconnect from our discovery signal. |
# And cleanup our snapshot | ||
OpenXRSpatialEntityExtension.free_spatial_snapshot(snapshot) | ||
|
||
func _process_snapshot(p_snapshot): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func _process_snapshot(p_snapshot): | |
func _process_snapshot(snapshot): |
var marker_list : OpenXRSpatialComponentMarkerList = OpenXRSpatialComponentMarkerList.new() | ||
result_data.push_back(marker_list) | ||
|
||
# Add in our bounded 2d component data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Add in our bounded 2d component data. | |
# Add our bounded 2D component data. |
# Copy the state | ||
entity_tracker.spatial_tracking_state = entity_state | ||
|
||
# Only if we're tracking, we should query the rest of our components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Only if we're tracking, we should query the rest of our components. | |
# If we're tracking, we should query the rest of our components. |
Or
# Only if we're tracking, we should query the rest of our components. | |
# Only if we're tracking should we query the rest of our components. |
This PR adds documentation for the spatial entities implementation being added here: godotengine/godot#107391